﻿module Utilities

open Microsoft.FSharp.Core.LanguagePrimitives
open System



type Random
    with
        member this.NextFloat with get() = this.NextDouble() |> float32

let Rand = new Random()

let Lerp (a:float32) (x:float32<'u>) (y:float32<'u>) = x * a + y * (1.0f - a)



let Clamp (lower:float32<'u>) (upper:float32<'u>) (v:float32<'u>) = v |> max lower |> min upper